-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for environment-specific UIO landing URLs first #397
Conversation
components/TransLine.tsx
Outdated
const uioLandingUrl = process.env.URL_UIO_LANDING ?? getUrl('uio-home-url-desktop') | ||
const uioMobileLandingUrl = process.env.URL_UIOMOBILE_LANDING ?? getUrl('uio-home-url-mobile') | ||
|
||
const uioHomeLink = userArrivedFromUioMobile ? uioMobileLandingUrl : uioLandingUrl | ||
if (uioHomeLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rocketnova I don't understand this if statement-- is it to protect against the possibility of uio-home-url-desktop/mobile, not existing as a string? If they do exist, then uioHomeLink will always be true right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript will yell if we don't narrow here, because the code doesn't know those json strings definitely exist - we have a ticket to see if there's some way to assert the json strings do exist #338
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUrl()
can return undefined. I'm not positive what happens if public/urls.json
disappears or is malformed or has a read-error, but there's definitely the possibility that public/urls.json
exists and the linkKey
passed in doesn't exist in the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript will yell if we don't narrow here, because the code doesn't know those json strings definitely exist - we have a ticket to see if there's some way to assert the json strings do exist #338
Agreed that we should know at build time, but I think the check is important in case something horrible and unexpected happens at runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, this all makes sense. Thanks!
README.md
Outdated
@@ -26,6 +26,7 @@ relates to weekly certification | |||
- CERTIFICATE_DIR: The path to the client certificate (certificate must be in PFX/P12 format) | |||
- PFX_FILE: The name of the client certificate file | |||
- (Optional) PFX_PASSPHRASE: The import passphrase for the client certificate if there is one | |||
- (Optional) URL_UIO_LANDING, URL_UIOMOBILE_LANDING: The environment-specific links to the UIO landing page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- (Optional) URL_UIO_LANDING, URL_UIOMOBILE_LANDING: The environment-specific links to the UIO landing page | |
- (Optional) URL_UIO_LANDING, URL_UIOMOBILE_LANDING: The environment-specific links to the UIO landing pages |
components/TransLine.tsx
Outdated
const uioLandingUrl = process.env.URL_UIO_LANDING ?? getUrl('uio-home-url-desktop') | ||
const uioMobileLandingUrl = process.env.URL_UIOMOBILE_LANDING ?? getUrl('uio-home-url-mobile') | ||
|
||
const uioHomeLink = userArrivedFromUioMobile ? uioMobileLandingUrl : uioLandingUrl | ||
if (uioHomeLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript will yell if we don't narrow here, because the code doesn't know those json strings definitely exist - we have a ticket to see if there's some way to assert the json strings do exist #338
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
components/TransLine.tsx
Outdated
// Optional environment-specific links back to the UIO landing page, used by EDD testing | ||
const uioLandingUrl = process.env.URL_UIO_LANDING ?? getUrl('uio-home-url-desktop') | ||
const uioMobileLandingUrl = process.env.URL_UIOMOBILE_LANDING ?? getUrl('uio-home-url-mobile') | ||
|
||
const uioHomeLink = userArrivedFromUioMobile ? uioMobileLandingUrl : uioLandingUrl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Not necessary for launch, but I think this is enough logic to put it somewhere else (like in getUrl.ts
) rather than in the component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I should have put it there. Moved!
components/TransLine.tsx
Outdated
const uioLandingUrl = process.env.URL_UIO_LANDING ?? getUrl('uio-home-url-desktop') | ||
const uioMobileLandingUrl = process.env.URL_UIOMOBILE_LANDING ?? getUrl('uio-home-url-mobile') | ||
|
||
const uioHomeLink = userArrivedFromUioMobile ? uioMobileLandingUrl : uioLandingUrl | ||
if (uioHomeLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUrl()
can return undefined. I'm not positive what happens if public/urls.json
disappears or is malformed or has a read-error, but there's definitely the possibility that public/urls.json
exists and the linkKey
passed in doesn't exist in the file.
This PR looks for a new environment variable to use as the UIO landing URL. If not found, it falls back to the current production/public UIO landing URL.
After this PR is merged, I'll add the SIT07 landing URLs to our test environment and test there
===
main